import { DynamicModule, Module } from '@nestjs/common';
import { DynamicmoduleService } from './dynamicmodule.service';
import { DynamicmoduleController } from './dynamicmodule.controller';
import { BbbModule } from 'src/bbb/bbb.module';
import { ExampleService } from '../example/example.service'
import { ExampleModule } from 'src/example/example.module';

@Module({
  imports: [ExampleModule.register({})],
  controllers: [DynamicmoduleController],
  providers: [DynamicmoduleService]
})
export class DynamicmoduleModule {
   static register(options: Record<string, any>): DynamicModule {
    return {
      module: BbbModule, 
      controllers: [ BbbModule ],
      providers: [
        {
          provide: 'CONFIG_OPTIONS',
          useValue: options,
        },
        ExampleService,
      ],
      exports: []
    }
   }
}
